<!DOCTYPE html>
<html>
<head>
    <meta http-equiv="Content-Type" content="text/html; charset=utf-8" />
    <meta content="IE=8" http-equiv="X-UA-Compatible" />
    <title>{%page_title_add}</title>
    {$QPath}
    <link rel="stylesheet" type="text/css" href="__TMPL__../Admin/Public/base.css" />
    <script type="text/javascript" src="__TMPL__../Admin/Public/jquery.js"></script>
    <script type="text/javascript" src="__TMPL__../Admin/Public/base.js"></script>
</head>
<body>
   <div id="container">
       <table class="tabmenu" cellspacing="0">
           <tbody>
               <tr>
                   <td style="width:12px">&nbsp;</td>
                   <td style="width:80px"><a href="__URL__/index"><span>{%page_title_index}</span></a></td>
                   <td class="here" style="width:80px"><a href="__URL__/add"><span>{%page_title_add}</span></a></td>
                   <td>&nbsp;</td>
                </tr>
            </tbody>
        </table>
        <div class="main">
            <div class="operate">
                <ul class="fnc">
                    <li><button type="button" class="btn" onclick="doAction('save')"><span><span>{%save}</span></span></button></li>
                </ul>
            </div>
            <div class="view">
                <form method="post" action="__URL__">
                    <table class="ips">
                        <tbody>
                            <tr>
                                <th class="essential"><label for="parentCategorys" >{%parent_cateogry}</label></th>
                                <td>
                                    <select id="parentCategorys" name="pid">
                                    </select>
                                    <script type="text/javascript">
                                        var optionPrefixCache={};
                                        var basePrefixStr="&nbsp;&nbsp;&nbsp;";
                                        optionPrefixCache["p0"]="";
                                        optionPrefixCache["p1"]=basePrefixStr;
                                        function getOptionPrefix(level){
                                            var key="p"+level;
                                            if( ! ( key in optionPrefixCache ) ){
                                                optionPrefixCache[key]=optionPrefixCache["p"+(parseInt(level)-1)]+basePrefixStr;
                                            }
                                            return optionPrefixCache[key];
                                        }
                                        var optionStr="";
                                        <iterate name="allCategorys" id="vo">
                                        optionStr+="<option value=\"{$vo['id']}\">"+getOptionPrefix({$vo['level']})+"{$vo['name']}</option>";
                                        </iterate>
                                        $("#parentCategorys").append(optionStr);
                                    </script>
                                </td>
                            </tr>
                            <tr>
                                <th class="essential"><label for="pk2">{$category_name}</label></th>
                                <td>
                                    <input id="pk2" type="text" name="name" maxlength="120" size="40" autocomplete="off" />
                                    <p class="hint">{%category_name_length_limit}</p>
                                </td>
                            </tr>
                        </tbody>
                    </table>
                </form>
            </div>
            <div class="operate">
                <ul class="fnc">
                    <li><button type="button" class="btn" onclick="doAction('save')"><span><span>{%save}</span></span></button></li>
                </ul>
            </div>
        </div>
    </div>
    <script type="text/javascript">
        function doAction(operate){
            if(operate=='save'){

            }
            $("form").attr("action","__URL__/"+operate).submit();
        }
    </script>
</body>
</html>
